<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Bad for loop</title>
  </head>
  <body>
    <script>
      for(let i = 1; i <= 10; i++) {
        const para = document.createElement('p');
        para.textContent = 'This is paragraph ' + i + '.';
        document.body.appendChild(para);
        para.onclick = function() {
          alert('Hello from paragraph ' + i + '!');
        }
      }
    </script>
  </body>
</html>
